﻿@page
@using LocalizeMessagesAndErrors
@using Microsoft.AspNetCore.Mvc.TagHelpers
@model ListUsersModel
@inject ISimpleLocalizer SimpleLocalizer

<h1>Auth users</h1>

@if (!string.IsNullOrEmpty(Model.Message))
{
    <h3 class="text-primary">@Model.Message</h3>
}

<a class="btn btn-primary" asp-area="" asp-page=".\SyncUsers">
    @SimpleLocalizer.LocalizeString("Sync with authentication provider's users", this)
</a>
<p></p>

<table class="table">
    <thead>
        <tr>
            <th>
                @SimpleLocalizer.LocalizeString("UserName", this)
            </th>
            <th>
                @SimpleLocalizer.LocalizeString("Email", this)
            </th>
            <th>
                @SimpleLocalizer.LocalizeString("Roles", this)
            </th>
            <th>
                @SimpleLocalizer.LocalizeString("Edit | Delete", this)
            </th>
        </tr>
    </thead>
    <tbody>
        @foreach (var item in @Model.AuthUserList)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.UserName)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Email)
                </td>
                <td>
                    @string.Join(", ", item.RoleNames)
                </td>
                <td>
                    <a asp-area="" asp-page=".\Edit" asp-route-userId="@item.UserId">
                        @SimpleLocalizer.LocalizeString("Edit", this)
                    </a>
                    |
                    <a asp-area="" asp-page=".\Delete" asp-route-userId="@item.UserId">
                        @SimpleLocalizer.LocalizeString("Delete", this)
                    </a>
                </td>
            </tr>
        }
    </tbody>
</table>



@section Scripts{


    <script type='text/javascript'>
        $(function () {
            $('[data-toggle="tooltip"]').tooltip();
        })
    </script>
}

